<extend name="Public/base" />

<block name="style" >
    <style>
        .user_table{
            border: 1px solid #ddd;
            width: 180px;
        }
        .user_table tr{
            border: 1px solid #dddddd;
            height: 30px;
        }
        .user_table td{
            border: 1px solid #dddddd;
            width: 90px;
            text-align: center;
        }
        .list-inline > li{width:30%;}
    </style>
</block>

<block name="body">
    <!-- 弹窗插件 -->
    <include file="Public:artdialog" />
    <!-- 表单验证插件 -->
    <include file="Public:validform" />

    <form action="{:U('addsupplier')}" method="post" role="form" class="form-horizontal row-border vform" id="formid" >  
        <div class="row">
            <div class="col-md-12">
                <div class="block-web">
                    <div class="header"> 
	                   <h3 class="content-header">编辑供应商</h3>
                    </div>
                    <div class="porlets-content">  
                        
                         <div class="form-group">
                            <label class="col-sm-2 control-label"><font class="red">*</font>公司名称</label>
                            <div class="col-sm-3">
                                <input type="text" value="{$entity.companyname}" name="companyname"  class="form-control " datatype="*" nullmsg="请输入公司名称" />
                                <div class="Validform_checktip"></div>
                            </div>
                            <label class="col-sm-2 control-label"><font class="red">*</font>ABN</label>
                            <div class="col-sm-3">
                                <input type="text" value="{$entity.abncode}" name="abncode"  class="form-control " datatype="*" nullmsg="请输入ABN" />
                                <div class="Validform_checktip"></div>
                            </div>
                        </div>   
                         <div class="form-group">
                            <label class="col-sm-2 control-label"><font class="red">*</font>联系人</label>
                            <div class="col-sm-3">
                                <input type="text" value="{$entity.linkname}" name="linkname"  class="form-control " datatype="*" nullmsg="请输入联系人" />
                                <div class="Validform_checktip"></div>
                            </div>
                            <label class="col-sm-2 control-label"><font class="red">*</font>联系方式</label>
                            <div class="col-sm-3">
                                <input type="text" value="{$entity.moblie}" name="moblie"  class="form-control " datatype="*" nullmsg="请输入联系方式" />
                                <div class="Validform_checktip"></div>
                            </div>
                        </div>    
                         <div class="form-group">
                            <label class="col-sm-2 control-label"><font class="red">*</font>地址</label>
                            <div class="col-sm-5">
                                <input type="text" value="{$entity.address}" name="address"  class="form-control " datatype="*" nullmsg="请输入地址" />
                                <div class="Validform_checktip"></div>
                            </div>
                        </div>   
                         <div class="form-group">
                           <if condition="$entity['user_id'] eq 0">
	                            <label class="col-sm-2 control-label"><font class="red">*</font>用户账号</label>
	                            <div class="col-sm-2">
	                                <input type="text" value=""  name="username"  class="form-control " datatype="*" nullmsg="请输入用户账号" />
	                                <div class="Validform_checktip"></div>
	                            </div>
	                            <label class="col-sm-1 control-label"><font class="red">*</font>用户密码</label>
	                            <div class="col-sm-2">
	                                <input type="password" value="" name="password"  id="password"  class="form-control"  datatype="*6-15" errormsg="密码范围在6~15位之间,不能使用空格！" />
	                                <div class="Validform_checktip"></div>
	                            </div>
	                            <label class="col-sm-1 control-label"><font class="red">*</font>确认密码</label>
	                            <div class="col-sm-2">
	                                <input type="password" value="" id="confirmpwd"  datatype="*"  class="form-control"  recheck="password"  errormsg="您两次输入的账号密码不一致！/>
	                                <div class="Validform_checktip"></div>
	                            </div>  
                            <else/>
                                <label class="col-sm-2 control-label">用户账号</label>
	                            <div class="col-sm-5">
	                                <input type="text" value="{$entity.username}"  readonly="true" name="username"  class="form-control" /> 
	                            </div> 
                            </if>
                        </div>     
                         <div class="form-group">
                            <label class="col-sm-2 control-label"><font class="red">*</font>微信信息</label>
                            <div class="col-sm-5"> 
                               <if condition="$entity['sp_id'] eq ''">
                                 <input type="text" value=""  id="openinfo"  class="form-control " datatype="*" nullmsg="请输入用户账号" /> 
                               <else/>
                                 <input type="text" value="{$entity.nickname}/{$entity['sex']==1?'男':'女'}/{$entity.country},{$entity.province},{$entity.city}"  id="openinfo"  class="form-control " datatype="*" nullmsg="请输入用户账号" /> 
                               </if>
                                
                                <div class="Validform_checktip"></div>
                            </div> 
                            <label class="control-label"><button type="button" class="btn btn-primary" id="selwxid">选择微信用户</button></label>
                        </div>  
                        <div class="form-group" >
                            <label class="col-sm-3 control-label"><font class="red">*</font>是否有效</label>
                            <div class="col-sm-6">
                                <label class="radio-inline">
                                    <input type="radio"  name="isactive" value="1"  {$entity['isactive']==1?'checked':''}>
                                    <span class="custom-radio"></span> 有效
                                </label>
                                <label class="radio-inline">
                                    <input type="radio"    name="isactive" value="0"  {$entity['isactive']==0?'checked':''}>
                                    <span class="custom-radio"></span> 无效
                                </label>
                                <label class="radio-inline">
                                    <input type="radio"    name="isactive" value="2"  {$entity['isactive']==2?'checked':''}>
                                    <span class="custom-radio"></span> 资料不合格
                                </label>
                                <label class="radio-inline">
                                    <input type="radio"    name="isactive" value="3"  {$entity['isactive']==3?'checked':''}>
                                    <span class="custom-radio"></span> 删除标识
                                </label> 
                            </div>
                        </div>    
                        <div class="form-group">
                            <label class="col-sm-3 control-label"></label>
                            <input type="hidden" name="sp_id" value="{$entity.sp_id}" id="spid"> 
                            <input type="hidden" name="openid" value="{$entity.openid}" id="openid">  
                            <button class="btn btn-primary btn-success bt_submit" type="submit" id="submit">提交</button>
                        </div>
                    </div><!--/porlets-content-->
                </div><!--/block-web-->
            </div> 
        </div> 
    </form> 

</block>
<block name="script"> 
<script type="text/javascript" src="__PUBLIC__/Admin/js/common_manage.js""></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/json2.js"></script>
<script type="text/javascript">  
var url="{:U('Wxopenuser/index')}";

/*var url = "/indexadmin.php/Wxopenuser/index";*/
var cookiename="wxinfo_<?php echo UID; ?>";
var reg=/^\d+(\.\d{0,2})?$/;  
$(function(){
	$("#selwxid").bind("click",showbox);
})

var showbox=function(){ 
    title="微信用户选择";  
    var mydialog=art.dialog.open(url,{title:title, width:'1200px', height:'80%', opacity: 0.2, id: "add_edit_id", 
  	    cancelVal: '取消',
  	    cancel: function(){this.close();}	
  });  
}


var fnsetwxinfo= function(){

	//获取cookie值 
	var _list=getCookie(cookiename);
	if(_list!=""){
	  ojson=JSON.parse(_list);
	}  
	  
	if(!ojson)return;
	var _val=ojson.nickname+"/"+ (ojson.sex==1?'男':'女')+"/"+ ojson.country+","+ojson.province+","+ojson.city;
	$("#openinfo").val(_val); 
	$("#openid").val(ojson.openid);
}

</script>
</block>
